<?php include_once('utils/message_view.php'); ?>  
<table id="tabela-list">
    <caption>
        <div id="search" class="tip">
            <?php echo form_open('editora/buscar','id="form-search"'); ?>
            <input id="search-field"  name="term" type="search" placeholder="Pesquisar editora" aria-label="Pesquisar editora" size="40" value="<?php echo set_value('term');?>"/>
            <input class="bt-search"  value="" type="submit" title="Buscar editora pelo <b>código</b> ou <b>nome.</b>"/>
            <?php echo form_close(); ?>
        </div>
    </caption>
    <thead>
        <tr>
            <th scope="col" class="check-select">
                <input type="checkbox" value="1" class="select-all" name="marcar-todos"/>
            </th>
            <th scope="col">Código</th>
            <th scope="col">Nome</th>
            <th scope="col">Telefone</th>
            <th scope="col">E-Mail</th>
            <th scope="col" class="tip">Site</th>
            <th scope="col" colspan="2">Operações</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <td colspan="8">
                <div id="paginacao">
                   <ul id="pagination">
                        <?php echo $pagination; ?>
                   </ul>
                </div>
                <div class="total-register">
                    <?php echo 'Total: ' . $total_rows . ' registros'; ?>
                </div>
            </td> 
        </tr>
    </tfoot>
    <tbody>
        <?php
        foreach ($editoras as $key => $editora): ?>
        <td>
            <input type="checkbox" name="cod[]" value="<?php echo $editora->codigo; ?>"/>
        </td>
        <td width="60">
            <?php echo $editora->codigo; ?>
        </td>
        <td class="pointer" ondblclick="javascript:atualizarEditora(<?php echo "'$editora->codigo'" . ',' . "'$editora->nome'" . ',' . "'$editora->telefone'" . ',' . "'$editora->email'" . ',' . "'$editora->site'"; ?>)">
            <?php echo $editora->nome; ?>        
        </td>
        <td>
            <?php echo $editora->telefone; ?>        
        </td>
        <td>
            <?php echo auto_link($editora->email,'email', TRUE); ?>        
        </td>
        <td>
            <?php echo auto_link($editora->site, 'url', TRUE); ?>        
        </td>
        <td align="center" width="20" class="tip">
            <a title="Editar registro da editora <?php echo "<br /><b>$editora->nome</b>"; ?>"
               onclick="javascript:atualizarEditora(<?php echo "'$editora->codigo'" . ',' . "'$editora->nome'" . ',' . "'$editora->telefone'" . ',' . "'$editora->email'" . ',' . "'$editora->site'"; ?>)">
                <img align="center" src="<?php echo site_url('assets/img/edit.png'); ?>" class="bt-table" />
            </a>
        </td>
        <td align="center" width="20" class="tip">
            <a title="Excluir a editora <?php echo "<br /><b>$editora->nome</b>"; ?>" onclick="javascript:excluirEditora(<?php echo "'$editora->codigo'" . ',' . "'$editora->nome'"; ?>)">
                <img align="center" src="<?php echo site_url('assets/img/delete.png'); ?>" class="bt-table" />
            </a>
        </td>
    </tr>    
<?php endforeach; ?>
</tbody>
</table>
<?php include_once 'editora_form.php'; ?>
<div class="tip"><button class="bt-new bt-editora" title="Abrir formulário para cadastrar editora" onclick="newEditora()">Adicionar novo</button></div>